<!-- File: /app/views/posts/index.ctp -->
<h2>STB Replacement</h2> 
<body ng-app="myApp">
<div ng-app="myApp" >
{{1+1}}
<?php 
	echo $this->Html->charset(); 	
	$this->Html->script("rep.js", array("inline"=>false));
	
	echo $this->Form->create('Replace', array('action' => 'add')); ?>
    <table>
		<tr>
			<td>
				<?php echo $this->Form->input('oldSTB',array
					('class' => 'input-medium',
					'label' => 'Old STB Number')); 
				?>
			</td>
			<td><?php echo $this->Form->input('newSTB',array('class' => 'input-medium','label' => 'New STB Number')); ?></td>
			<td><?php echo $this->Form->input('cardno',array('class' => 'input-medium')); ?></td>	
			<td><?php echo $this->Form->input('replacedate',array('class' => 'input-small')); ?></td>
			<td><?php echo $this->Form->input('comments', array('rows' => '3')); ?></td>
			<td><?php echo $this->Form->input('Replace.id', array('type' => 'hidden')); ?></td>
		</tr>		
	</table>
    <?php echo $this->Form->end('Save replacement'); 	
		
	?>
<br/>
<h3>Replacements</h3>
<table>
    <tr>
        <th>Id</th>
        <th>Old STB No</th>
        <th>New STB No</th>
        <th>Card No</th>
        <th>Replace Date</th>
        <th>Comments</th>
        <th>Edit Record</th>
        <th>Delete Record</th>
    </tr>

    <!-- Here is where we loop through our $posts array, printing out post info -->

    <?php 			
	foreach ($rep as $post): ?>
    <tr>
        <td><?php echo $post['Replace']['id'];  ?></td>
        <td><?php echo $post['Replace']['oldSTB'];  ?></td>        
        <td><?php echo $post['Replace']['newSTB'];?></td>
        <td><?php echo $post['Replace']['cardno'];?></td>
        <td><?php echo $post['Replace']['replacedate'];?></td>
        <td><?php echo $post['Replace']['comments'];?></td>
		<td><?php echo $this->Html->link('Edit', array('action' => 'edit', $post['Replace']['id'])); ?></td>
		<td><?php echo $this->Form->postLink(
                'Delete',
                array('action' => 'delete', $post['Replace']['id']),
                array('confirm' => 'Are you sure you want to delete this post?'));
?></td>
    </tr>
    <?php endforeach; ?>
</table>

</div>
</body>